<?php
Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl.'/assets/tool/uploadify/uploadify.css');
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl.'/assets/tool/uploadify/jquery.uploadify.js',CClientScript::POS_BEGIN); 
?>
<div class="tab_menu" style="position: relative;bottom: -8px;*bottom: -28px;">
	<div class="tab_control tab_selected" onclick="changeTab(this,'load_list');">Quản Lý</div>
	<div id="btn_new" class="tab_control" onclick="changeTab(this,'add_new');">Thêm Mới</div>
</div>
<div class="clear"></div>
<div class="box">

    <div class="box_content_no_border" id="div_contentBox">

    </div><!--End box_content_no_border-->
</div><!--End box-->

<div
	id		= "dialog_excute"
	title	= "Chương trình đang thực thi"
	class	= "dialog_message"
>
	<p class="center">
		<img alt="Loading...." src="<?=Yii::app()->baseUrl;?>/images/image_default/loading_circle.gif" width="92px" height="92px"/>
	</p>
</div> <!--End dialog_excute-->
	
<div
    id		= "dialog_notice"
    title	= "Người Dùng"
    class	= "dialog_message"
>
	<div id="content">
	</div>
</div><!--End dialog_notice-->

<script type="text/javascript">

$(document).ready(function () {

    $("#dialog_excute").dialog({
        autoOpen: false,
        closeOnEscape: false,
        width: 220,
        height: 152,
        modal: true,
        resizable: false,
        show: "explode",
        hide: "explode",
        open: function (event, ui) { $(".ui-dialog-titlebar-close").hide(); }
    });

    $("#dialog_notice").dialog({
        autoOpen: false,
        closeOnEscape: true,
        width: "90%",
        height: "auto",
        modal: true,
        show: "explode",
        hide: "explode"
    });

    create_list();
});


function changeTab (element, s_method)
{
	$(".tab_control").each(function(index) {
		
	    $(this).removeClass("tab_selected");
	});

	$(element).addClass("tab_selected");

	if(s_method == "load_list")
		create_list();
	else if (s_method == "add_new")
		call_edit_page(0);
	else if (s_method == "import_excel")
		create_importExcel();
}

function create_list()
{
	$.ajax({
		url		: "<?=Yii::app()->createUrl("product/list")?>",
		type	: "POST",
		cache	: false,
		data	: {},
		dataType: "html",
		success	: function(html){
			
			$("#div_contentBox").html(html);
		},
		error: function (){
			
			alert("Trang hiện hành không tồn tại.");
		}
	});
}
</script>